package og.jaaksi.test.gridview;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.FrameLayout;

/**
 * Created by Fcy on 2016/3/9.
 */
public class AutoFrameLayout extends FrameLayout
{
	public AutoFrameLayout(Context context)
	{
		super(context);
	}

	public AutoFrameLayout(Context context, AttributeSet attrs)
	{
		super(context, attrs);
	}

	public AutoFrameLayout(Context context, AttributeSet attrs,
	        int defStyleAttr)
	{
		super(context, attrs, defStyleAttr);
	}

	@Override
	protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
	{
//		setMeasuredDimension(getDefaultSize(0, widthMeasureSpec),
//		        getDefaultSize(0, heightMeasureSpec));
//
//		// Children are just made to fill our space.
//		int childWidthSize = getMeasuredWidth();
//		// 高度和宽度一样
//		heightMeasureSpec = widthMeasureSpec = MeasureSpec
//		        .makeMeasureSpec(childWidthSize, MeasureSpec.EXACTLY);
//		super.onMeasure(widthMeasureSpec, heightMeasureSpec);

		 super.onMeasure(widthMeasureSpec, widthMeasureSpec);
	}
}
